import Mock from "mockjs"

const users=[{
    "username":'admin',
    "password":'123'
},{
    "username":'user',
    "password":'123'
}]

Mock.mock('/api/login','post',(req:any,res:any)=>{
    console.log(req.body)
    const {username,password}=JSON.parse(req.body)
    const isUser=users.some(item=>item.username===username&&item.password===password)
    if(isUser){
        
        return({
            code:200,
            mes:'登陆成功',
            data:123
        })
    }else{
        return({
            code:400,
            mes:'账号密码输入有误',
            data:'0'
        })
    }
})